package com.coke.spring.security.token;

import lombok.Getter;
import lombok.Setter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author cwm
 * @Description 手机验证授权对象实体类
 * @date 2021/8/26 下午1:21
 * @Version 1.0
 */
public class MobelAuthenticationToken extends AbstractAuthenticationToken {
    @Getter
    @Setter
    private String phone;
    @Getter
    @Setter
    private String code;

    public MobelAuthenticationToken(String phone, String code) {
        super(null);
        this.phone = phone;
        this.code = code;
        super.setAuthenticated(false);
    }

    public MobelAuthenticationToken(String phone,String code,Collection<? extends GrantedAuthority> authorities){
        super(authorities);
        this.phone = phone;
        this.code = code;
        super.setAuthenticated(true);
    }
    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return null;
    }
}
